home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat3 / librw / RWTPtrSetIterator.z / RWTPtrSetIterator
Encoding:
Text File  |  2002-10-03  |  6.9 KB  |  199 lines

  1.  
  2.  
  3.  
  4. RRRRWWWWTTTTPPPPttttrrrrSSSSeeeettttIIIItttteeeerrrraaaattttoooorrrr((((3333CCCC++++++++))))                                RRRRWWWWTTTTPPPPttttrrrrSSSSeeeettttIIIItttteeeerrrraaaattttoooorrrr((((3333CCCC++++++++))))
  5.  
  6.  
  7.  
  8. NNNNaaaammmmeeee
  9.      RWTPtrSetIterator<T,C> - Rogue Wave library class
  10.  
  11. SSSSyyyynnnnooooppppssssiiiissss
  12.               #include<rw/tpset.h>
  13.  
  14.  
  15.  
  16.               RWTPtrSet<T,C> set;
  17.           RWTPtrSetIterator<T,C> itr(set);
  18.  
  19. SSSSttttaaaannnnddddaaaarrrrdddd CCCC++++++++ LLLLiiiibbbbrrrraaaarrrryyyy DDDDeeeeppppeeeennnnddddeeeennnntttt!!!!
  20.      RRRRWWWWTTTTPPPPttttrrrrSSSSeeeettttIIIItttteeeerrrraaaattttoooorrrr requires the Standard C++ Library.
  21.  
  22.  
  23. DDDDeeeessssccccrrrriiiippppttttiiiioooonnnn
  24.      RRRRWWWWTTTTPPPPttttrrrrSSSSeeeettttIIIItttteeeerrrraaaattttoooorrrr is supplied with Tools 7 to provide an iterator
  25.      interface to the new Standard Library based collections that has backward
  26.      compatibility with the container iterators provided in Tools 6. The order
  27.      of iteration over an RRRRWWWWTTTTPPPPttttrrrrSSSSeeeetttt is dependent on the comparator object
  28.      supplied as applied to the values stored in the container.  The current
  29.      item referenced by this iterator is undefined after construction or after
  30.      a call to rrrreeeesssseeeetttt(((()))).  The iterator becomes valid after being advanced with
  31.      either a preincrement or ooooppppeeeerrrraaaattttoooorrrr(((()))).  For both ooooppppeeeerrrraaaattttoooorrrr++++++++ and ooooppppeeeerrrraaaattttoooorrrr(((()))),
  32.      iterating past the last element will return a value equivalent to boolean
  33.      ffffaaaallllsssseeee.  Continued increments will return a value equivalent to ffffaaaallllsssseeee
  34.      until rrrreeeesssseeeetttt(((()))) is called.
  35.  
  36. PPPPeeeerrrrssssiiiisssstttteeeennnncccceeee
  37.      None
  38.  
  39. EEEExxxxaaaammmmpppplllleeeessss
  40.               #include<rw/tpset.h>
  41.  
  42.  
  43.  
  44.               #include<iostream.h>
  45.           #include<rw/cstring.h>
  46.  
  47.  
  48.               int main(){
  49.  
  50.  
  51.  
  52.                  RWTPtrSet<RWCString,less<RWCString> > a;
  53.              RWTPtrSetIterator<RWCString,less<RWCString> > itr(a);
  54.  
  55.  
  56.                  a.insert(new RWCString("John"));
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. RRRRWWWWTTTTPPPPttttrrrrSSSSeeeettttIIIItttteeeerrrraaaattttoooorrrr((((3333CCCC++++++++))))                                RRRRWWWWTTTTPPPPttttrrrrSSSSeeeettttIIIItttteeeerrrraaaattttoooorrrr((((3333CCCC++++++++))))
  71.  
  72.  
  73.  
  74.                  a.insert(new RWCString("Steve"));
  75.              a.insert(new RWCString("Mark"));
  76.  
  77.  
  78.               //Rejected, duplicate insertions not allowed
  79.  
  80.  
  81.  
  82.                  a.insert(new RWCString("Steve"));
  83.  
  84.  
  85.  
  86.                  for(;itr();)
  87.  
  88.  
  89.  
  90.                    cout << *itr.key() <<endl;
  91.  
  92.  
  93.  
  94.                  return 0;
  95.  
  96.  
  97.  
  98.               }
  99.           Program Output
  100.           John
  101.           Mark
  102.  
  103. PPPPuuuubbbblllliiiicccc CCCCoooonnnnssssttttrrrruuuuccccttttoooorrrrssss
  104.      Steve
  105.  
  106.  
  107.  
  108.               RRRRWWWWTTTTPPPPttttrrrrSSSSeeeettttIIIItttteeeerrrraaaattttoooorrrr<<<<TTTT,,,,CCCC>>>>(const RWTPtrSet<T,C>& s);
  109.  
  110.  
  111.      Creates an iterator for the set ssss.  The iterator begins in an undefined
  112.      state and must be advanced before the first element will be accessible
  113.  
  114. PPPPuuuubbbblllliiiicccc MMMMeeeemmmmbbbbeeeerrrr OOOOppppeeeerrrraaaattttoooorrrrssss
  115.               T*
  116.           ooooppppeeeerrrraaaattttoooorrrr(((())))();
  117.  
  118.  
  119.      Advances self to the next element, dereferences the resulting iterator
  120.      and returns its value.  If the iterator has advanced past the last item
  121.      in the container,  the element returned will be a nnnniiiillll pointer equivalent
  122.      to boolean ffffaaaallllsssseeee.
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. RRRRWWWWTTTTPPPPttttrrrrSSSSeeeettttIIIItttteeeerrrraaaattttoooorrrr((((3333CCCC++++++++))))                                RRRRWWWWTTTTPPPPttttrrrrSSSSeeeettttIIIItttteeeerrrraaaattttoooorrrr((((3333CCCC++++++++))))
  137.  
  138.  
  139.  
  140.               RWBoolean
  141.           ooooppppeeeerrrraaaattttoooorrrr++++++++();
  142.  
  143.  
  144.      Advances self to the next element.  If the iterator has been reset or
  145.      just created self will now reference the first element.  If, before
  146.      iteration, self referenced the last association in the set, self will now
  147.      reference an undefined value and a value equivalent to ffffaaaallllsssseeee will be
  148.      returned.  Otherwise, a value equivalent to ttttrrrruuuueeee is returned. Note: no
  149.      post-increment operator is provided.
  150.  
  151. PPPPuuuubbbblllliiiicccc MMMMeeeemmmmbbbbeeeerrrr FFFFuuuunnnnccccttttiiiioooonnnnssss
  152.               RWTPtrSet<T,C>*
  153.           ccccoooonnnnttttaaaaiiiinnnneeeerrrr(((()))) const;
  154.  
  155.  
  156.      Returns a pointer to the collection being iterated over.
  157.  
  158.               T*
  159.           kkkkeeeeyyyy() const;
  160.  
  161.  
  162.      Returns the stored value pointed to by sssseeeellllffff. Undefined if self is not
  163.      referencing a value within the set.
  164.  
  165.               void
  166.           rrrreeeesssseeeetttt();
  167.           void
  168.           rrrreeeesssseeeetttt(RWTPtrSet<T,C>& h);
  169.  
  170.  
  171.      Resets the iterator so that after being advanced it will point to the
  172.      first element of the collection.  Using rrrreeeesssseeeetttt(((()))) with no argument will
  173.      reset the iterator on the current container.  Supplying a RRRRWWWWTTTTPPPPttttrrrrSSSSeeeetttt to
  174.      rrrreeeesssseeeetttt(((()))) will reset the iterator on the new container.
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.